package generator.statements;

/**
 * OfferAttractionReservation SQL record mapper.
 * 
 * @author Necro
 * @author Marek Snopkowski <snpy@snpy.info>
 * @version 12.04.2008
 */
public class OfferAttractionReservation extends Statement
{
    private Attraction attraction;
    private Offer offer;
    private Reservation reservation;
    
    @Override
    public int getId() throws UnsupportedOperationException
    {
        return attraction.getId() + (offer.getId() << 8) + (reservation.getId() << 16);
    }

    public OfferAttractionReservation(Attraction attraction, Offer offer, Reservation reservation)
    {
        this.attraction  = attraction;
        this.offer       = offer;
        this.reservation = reservation;
    }
    
    public Object[] getFieldsValueCollection()
    {
        return new Object[]{ attraction.getId(), offer.getId(), reservation.getId() };
    }
    
    public String getFieldsNameSet()
    {
        return "[attraction_id], [offer_id], [reservation_id]";
    }
     
    @Override
    public String getTableName()
    {
        return "offer_attraction_reservation";
    }
}
